package com.gui;

import java.util.List;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class DMSServerAdapter extends ArrayAdapter<DMSServer> {
	Activity context = null;;
	List<DMSServer> data = null;
	
	public DMSServerAdapter(Activity context, int resource, int textViewResourceId,
			List<DMSServer> objects) {
		super(context, resource, textViewResourceId, objects);
		this.context = context;
		this.data = objects;	
	}

	public void setData(List<DMSServer> data){
		this.data  = data;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		 View rowView = inflater.inflate(R.layout.browser, null, true);
		 DMSServer server = data.get(position);
		 ((TextView) rowView.findViewById(R.id.tv_label)).setText(server.getName());		
		return rowView;
	}
}